package com.sushi.controller;

import com.sushi.bean.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/try")
public class TryController {
    @Autowired
    private Book book;

    @Autowired
    private Environment environment;

    @GetMapping("/{number}")
    public String tryIt(@PathVariable int number) {
        System.out.println(environment.getProperty("shit"));
        System.out.println(environment.getProperty("book.name"));
        return "启动成功!";
    }

    @GetMapping
    public Book getBook() {
        System.out.println(book);
        return book;
    }


}
